package com.trkj.controller.hjj;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.trkj.pojo.Affairtypeconfirm;
import com.trkj.pojo.Holiday;
import com.trkj.pojo.Leaveconfirm;
import com.trkj.service.hjj.ConfirmTransactionService;
import com.trkj.vo.AffaircatetypeVo;
import com.trkj.vo.LeaveVo;


@Controller
public class ConfirmTransactionController {
	@Autowired
	private ConfirmTransactionService confirmTransactionService;
	
	/**
	 * 分页查询外勤
	 * @param page
	 * @param rows
	 * @return
	 */
	@RequestMapping("to_is_confirms")
	@ResponseBody
	public Map findConfirms(int page,int rows){
		long total = confirmTransactionService.ConfirmCount();
		List<AffaircatetypeVo> list =confirmTransactionService.findAllAffairtype(page, rows);
		System.out.println(list);
		Map map = new HashMap<>();
		map.put("total", total);
		map.put("rows", list);
		return map;
	}
	/**
	 * 分页查询请假确认
	 * @param page
	 * @param rows
	 * @return
	 */
	@RequestMapping("to_is_allLeave")
	@ResponseBody
	public Map findAllLeave(int page,int rows){
		long total =confirmTransactionService.findAllLeave(page, rows).size();
		System.out.println(total);
		List<LeaveVo> list =confirmTransactionService.findAllLeave(page, rows);
		System.out.println(list);
		Map map = new HashMap<>();
		map.put("total", total);
		map.put("rows", list);
		return map;
	}
	@RequestMapping("is_to_all_holiday")
	@ResponseBody
	public List<Holiday> findAllHoliday(){
		return confirmTransactionService.findAllHoliday();
	}
	
	
	@RequestMapping("to_is_findaajiaban")
	@ResponseBody
	public Map findAlljiaban(int page,int rows){
		
		long total = confirmTransactionService.finadjiaban(page, rows).size();
		List<AffaircatetypeVo> list =confirmTransactionService.finadjiaban(page, rows);
		Map map = new HashMap<>();
		map.put("total", total);
		map.put("rows", list);
		return map;
	}
	
}
